package ynu.edu.online_course.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import ynu.edu.online_course.entity.Material;

@Mapper
public interface MaterialMapper {

    @Insert("INSERT INTO material (course_id, material_name, file_url, create_at) " +
            "VALUES (#{course.id}, #{material_name}, #{fileUrl}, #{createAt})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insertMaterial(Material material);
}
